package com.jason.choosenamefx;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

import java.io.IOException;


/**
 * 随机点名工具的入口程序
 */
public class AppApplication extends Application {

    /**
     * app 图标
     */
    static String APP_ICO_PATH = "/img/icon/app_ico.png";

    /**
     * 首页逻辑
     */
    static  String APP_XML_VIEW = "app-view.fxml";

    /**
     * 测试页面数据
     */
    static String TEST_APP_XML_VIEW = "test-app-view.fxml";

    /**
     * 加载自定义css文件
     */
    static String MY_BTN_CSS = "css/my_btn.css";
    @Override
    public void start(Stage stage) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader(AppApplication.class.getResource(TEST_APP_XML_VIEW));
        Image  bg_icon = new Image(getClass().getResourceAsStream(APP_ICO_PATH));
        stage.getIcons().add(bg_icon);
        Scene scene = new Scene(fxmlLoader.load());
        scene.getStylesheets().add(getClass().getResource(MY_BTN_CSS).toExternalForm());
        stage.setTitle("随机点名器@By佛系小吴#V1.0");
        stage.setScene(scene);
        //禁止调整大小
        stage.setResizable(false);
        stage.show();
    }

    /**
     * main函数 启动入口
     * @param args
     */
    public static void main(String[] args) {
        launch();
    }
}